You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > Statistics Class > Statistics Methods > Histogram Method > Statistics.Histogram Method ([In] TVec, [In] int, [In] TVec, [In] TVec, bool)
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
Statistics.Histogram Method ([In] TVec, [In] int, [In] TVec, [In] TVec, bool)

Divide the Data vector elements into NumBins equal intervals.

Syntax
C#
Visual Basic
public static void Histogram([In] TVec Data, [In] int NumBins, [In] TVec Results, [In] TVec Bins, bool CenterBins);

The number of elements falling in each interval is counted and the result for each interval (frequency distribution) is written to the Results vector. if CenterBins is true then Bins will store bins center points. If CenterBins is false, Bins will store bins edges.The Length and Complex properties of the Results and Bins vectors are adjusted automatically. 

Note Use this version if you need equidistant histogram.

Equal bins -> faster algorithm.

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector Data = new Vector(1000); Vector Bins = new Vector(0); Vector Freq = new Vector(0); StatRandom.RandomNormal(-3,0.2,Data,-1); // generate some normaly distributed data // Now, divide the data into 15 equal intervals Statistics.Histogram(Data,15,Freq,Bins,true); // Bins holds the 15 intervals centerpoints // and Freq holds the count of elements in each bin } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!